package com.hengpeng.itfin.persist.impl;

import org.springframework.stereotype.Repository;

import com.hengpeng.common.persist.AbstractDao;
import com.hengpeng.common.persist.query.DynamicQuery;
import com.hengpeng.itfin.persist.AccountDao;
import com.hengpeng.itfinbase.persist.Account;

@Repository
public class AccountDaoImpl extends AbstractDao<Account> implements AccountDao {
    
    @Override
    public Account getAccountByUserId(Long userId) {
        DynamicQuery query = new DynamicQuery(Account.class);
        query.eq("userId", userId);
        return super.getSingleByDynamicQuery(query);
    }

    @Override
    public Account getAccountByUserIdAndSub(Long userId, String subaccountId) {
        DynamicQuery query = new DynamicQuery(Account.class);
        query.eq("userId", userId);
        query.eq("subAccountId", subaccountId);
        return super.getSingleByDynamicQuery(query);
    }
}
